package config

import (
	"github.com/spf13/viper"
	"log"
)

type Nachos struct {
	NamespaceId string
	IpAddr      string
	Port        int
	DataId      string
	Group       string
}
type AllConf struct {
	Nachos
}

var ViperData AllConf

func InitViper() {
	viper.SetConfigFile("../common/config/dev.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		log.Fatal(err.Error())
	}
	err = viper.Unmarshal(&ViperData)
	if err != nil {
		log.Fatal(err.Error())
	}
	log.Println("Init viper success")
}
